package com.food.dao.service;

import java.util.Arrays;

import com.food.dao.ManagerDAOJdbc;
import com.food.dao.in.ManagerDAO;
import com.food.model.Manager;
import com.food.model.Member;

public class ManagerService {
	ManagerDAO dao = new ManagerDAOJdbc();
	
	public void insertManager(Manager bean){
		dao.insertManager(bean);
		
	}
	
	
	public Manager login(String username, String password) {
		Manager bean = dao.findManagerByAccount(username);
		if(bean!=null) {
			if(password!=null && password.length()!=0) {
				byte[] pass = bean.getMgpassword();	//��Ʈw�x�s���ýX
				byte[] temp = password.getBytes();	//�ϥΪ̿�J����X
			//	temp = md.digest(temp);				//�ýX
				if(Arrays.equals(pass, temp)) {
					return bean;
				}
			}
		}
		return null;
	}
	public Manager findManager(Manager bean){
		return dao.findManager(bean.getMgid());
	}
}
